<%@ page import="org.xilin.Family" %>
<g:setProvider library="jquery"/>

<div>
  <g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
  </g:if>
  <g:hasErrors bean="${familyInstance}">
    <div class="errors">
      <g:renderErrors bean="${familyInstance}" as="list" />
    </div>
  </g:hasErrors>
  <g:formRemote name="updateFamily" url="${[action:'update']}" method="post" update=".content" before="beforeSave()" onComplete="processResponse()">
    <g:hiddenField name="view" value="edit" />
    <g:hiddenField name="version" value="${familyInstance?.version}" />
    <div class="dialog">
      <table>
        <tbody>
          <tr class="prop">
            <td valign="top" class="name">
              <label for="userId"><g:message code="family.userId.label" default="User Id" /></label>
            </td>
            <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'userId', 'errors')}">
        <g:textField name="userId" readonly="true" value="${fieldValue(bean: familyInstance, field: 'userId')}" />
        <g:hiddenField name="id" value="${params.id}" />
        </td>
        </tr>
        <tr class="prop">
          <td valign="top" class="name">
            <label for="email">Email</label>
          </td>
          <td valign="top" class="value">
        <g:textField name="email" value="${loggedInUserInfo(field:'email')}" />
        </td>
        </tr>
        <tr class="prop">
          <td valign="top" class="name">
            <label for="fatherFirstName"><g:message code="family.fatherFirstName.label" default="Father First Name" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'fatherFirstName', 'errors')}">
        <g:textField name="fatherFirstName" value="${familyInstance?.fatherFirstName}" />
        </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="fatherLastName"><g:message code="family.fatherLastName.label" default="Father Last Name" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'fatherLastName', 'errors')}">
        <g:textField name="fatherLastName" value="${familyInstance?.fatherLastName}" />
        </td>
        </tr>
        <tr class="prop">
          <td valign="top" class="name">
            <label for="fatherChineseName"><g:message code="family.fatherChineseName.label" default="Father Chinese Name" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'fatherChineseName', 'errors')}">
        <g:textField name="fatherChineseName" value="${familyInstance?.fatherChineseName}" />
        </td>
        </tr>
        <tr class="prop">
          <td valign="top" class="name">
            <label for="motherFirstName"><g:message code="family.motherFirstName.label" default="Mother First Name" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'motherFirstName', 'errors')}">
        <g:textField name="motherFirstName" value="${familyInstance?.motherFirstName}" />
        </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="motherLastName"><g:message code="family.motherLastName.label" default="Mother Last Name" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'motherLastName', 'errors')}">
        <g:textField name="motherLastName" value="${familyInstance?.motherLastName}" />
        </td>
        </tr>
        <tr class="prop">
          <td valign="top" class="name">
            <label for="motherChineseName"><g:message code="family.motherChineseName.label" default="Mother Chinese Name" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'motherChineseName', 'errors')}">
        <g:textField name="motherChineseName" value="${familyInstance?.motherChineseName}" />
        </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="address"><g:message code="family.address.label" default="Address" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'address', 'errors')}">
        <g:textField name="address" value="${familyInstance?.address}" />
        </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="city"><g:message code="family.city.label" default="City" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'city', 'errors')}">
        <g:textField name="city" value="${familyInstance?.city}" />
        </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="state"><g:message code="family.state.label" default="State" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'state', 'errors')}">
        <g:textField name="state" value="${familyInstance?.state}" />
        </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="zipCode"><g:message code="family.zipCode.label" default="Zip Code" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'zipCode', 'errors')}">
        <g:textField name="zipCode" value="${familyInstance?.zipCode}" />
        </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="homeTel"><g:message code="family.homeTel_1.label" default="Home Phone" /></label>
          </td>
          <td valign="top" class="value">
        <g:textField name="homeTel_1" size="3" value="${familyInstance?.homeTel_1}" />
        <g:textField name="homeTel_2" size="3" value="${familyInstance?.homeTel_2}" />
        <g:textField name="homeTel_3" size="4" value="${familyInstance?.homeTel_3}" />
        </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="workTel"><g:message code="family.workTel_1.label" default="Work Phone" /></label>
          </td>
          <td valign="top" class="value">
        <g:textField name="workTel_1" size="3" value="${familyInstance?.workTel_1}" />
        <g:textField name="workTel_2" size="3" value="${familyInstance?.workTel_2}" />
        <g:textField name="workTel_3" size="4" value="${familyInstance?.workTel_3}" /> X
        <g:textField name="workTel_ext" size="4" value="${familyInstance?.workTel_ext}" />
        </td>
        </tr>
        </tbody>
      </table>
    </div>
    <div class="buttons">
      <span class="button"><g:submitButton name="save" class="save" value="${message(code: 'default.button.edit.label', default: 'Save')}" /></span>
      <span class="button"><input type="reset" value="${message(code: 'default.button.clear.label', default: 'Reset')}" /></span>
    </div>
  </g:formRemote>
</div>
